Add an error message when both myst_nb and myst_parser included in extensions#713
Open
frankier wants to merge 1 commit intoexecutablebooks:mainfrom
Open
Add an error message when both myst_nb and myst_parser included in extensions#713frankier wants to merge 1 commit intoexecutablebooks:mainfrom
frankier wants to merge 1 commit intoexecutablebooks:mainfrom
Conversation
bsipocz
requested changes
Apr 13, 2026
Member
bsipocz
left a comment
There was a problem hiding this comment.
While this looks good on the diff level, I don't see it actually having any effect locally if you change the order of the extensions in the config file.
conf.py:
extensions = [
'myst_nb',
'myst_parser',
]
traceback:
Extension error!
Versions
========
* Platform: darwin; (macOS-12.5.1-arm64-arm-64bit)
* Python version: 3.12.1 (CPython)
* Sphinx version: 9.1.0
* Docutils version: 0.21.2
* Jinja2 version: 3.1.6
* Pygments version: 2.18.0
Last Messages
=============
None.
Loaded Extensions
=================
None.
Traceback
=========
Traceback (most recent call last):
File "/Users/bsipocz/.pyenv/versions/3.12.1/lib/python3.12/site-packages/sphinx/cmd/build.py", line 414, in build_main
app = Sphinx(
^^^^^^^
File "/Users/bsipocz/.pyenv/versions/3.12.1/lib/python3.12/site-packages/sphinx/application.py", line 299, in __init__
self.setup_extension(extension)
File "/Users/bsipocz/.pyenv/versions/3.12.1/lib/python3.12/site-packages/sphinx/application.py", line 505, in setup_extension
self.registry.load_extension(self, extname)
File "/Users/bsipocz/.pyenv/versions/3.12.1/lib/python3.12/site-packages/sphinx/registry.py", line 569, in load_extension
metadata = setup(app)
^^^^^^^^^^
File "/Users/bsipocz/.pyenv/versions/3.12.1/lib/python3.12/site-packages/myst_parser/__init__.py", line 13, in setup
setup_sphinx(app, load_parser=True)
File "/Users/bsipocz/.pyenv/versions/3.12.1/lib/python3.12/site-packages/myst_parser/sphinx_ext/main.py", line 37, in setup_sphinx
app.add_source_suffix(".md", "markdown")
File "/Users/bsipocz/.pyenv/versions/3.12.1/lib/python3.12/site-packages/sphinx/application.py", line 1726, in add_source_suffix
self.registry.add_source_suffix(suffix, filetype, override=override)
File "/Users/bsipocz/.pyenv/versions/3.12.1/lib/python3.12/site-packages/sphinx/registry.py", line 350, in add_source_suffix
raise ExtensionError(__('source_suffix %r is already registered') % suffix)
sphinx.errors.ExtensionError: source_suffix '.md' is already registered
The full traceback has been saved in:
/var/folders/9s/070g0pd502q70k3gffpxv8km0000gq/T/sphinx-err-cmvshwrb.log
To report this error to the developers, please open an issue at <https://github.com/sphinx-doc/sphinx/issues/>. Thanks!
Please also report this if it was a user error, so that a better error message can be provided next time.
| if "myst_parser" in app.extensions: | ||
| raise ValueError( | ||
| "Cannot load both myst_nb and myst_parser Sphinx extensions " | ||
| "-- load only myst_nb since it includes myst_parser" |
Member
There was a problem hiding this comment.
Maybe rephrase to be more clear about the action item:
Suggested change
| "-- load only myst_nb since it includes myst_parser" | |
| "-- please only list only myst_nb as an extension in your configuration since it includes myst_parser." |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #653